import React, { useRef, useEffect, forwardRef } from 'react'
import { useGLTF, useAnimations } from '@react-three/drei'

const ShuttleCar = forwardRef((props, ref) => {
  const { nodes, materials, animations } = useGLTF('/models/shuttleCar.glb')
  const { actions } = useAnimations(animations, ref)
  useEffect(() => {
    for (const k in actions) {
      actions[k].play()
    }
  }, [actions]);
  return (
    <group visible={false} ref={ref} scale={0.001} dispose={null} >
      <group scale={0.16} position={[0, -0.4, -2.5]}>
        <mesh geometry={nodes.立方体007.geometry} material={materials['材质.007']} position={[0.008373, 0.45799, 2.2282]} scale={[-3.846221, -0.141339, 15.361928]} />
        <mesh geometry={nodes.立方体002.geometry} material={materials.PaletteMaterial001} position={[0.008373, 0.45799, -8.008881]} scale={[-3.846221, -0.141339, 15.361928]} />
        <mesh geometry={nodes.立方体003.geometry} material={materials.PaletteMaterial002} position={[0.008373, 0.45799, -8.008881]} scale={[-3.846221, -0.141339, 15.361928]} />
        <mesh geometry={nodes.立方体028.geometry} material={materials.PaletteMaterial003} position={[0.008373, 0.45799, -8.008881]} scale={[-3.846221, -0.141339, 15.361928]} />
        <mesh geometry={nodes.立方体.geometry} material={materials.PaletteMaterial004} position={[-14.848938, 0.270195, 49.930466]} rotation={[0, 0, -0.317727]} scale={[1.504567, 0.110071, 1.956948]} />
        <mesh geometry={nodes.立方体902.geometry} material={nodes.立方体902.material} position={[16.16968, 0.381445, 46.990646]} rotation={[0, 0, -2.768897]} scale={[1, -0.141862, 0.214136]} />
        <mesh geometry={nodes.defaultMaterial009.geometry} material={materials.lambert2SG_1001} position={[18.862822, -0.631772, 10.493916]} rotation={[Math.PI / 2, 0, -Math.PI / 2]} scale={0.004845} />
        <mesh geometry={nodes.立方体008.geometry} material={materials['材质.006']} position={[0.008373, 0.45799, 2.2282]} scale={[-3.846221, -0.141339, 15.361928]} />
      </group>
    </group>
  )
})

useGLTF.preload('/models/shuttleCar.glb')

export default ShuttleCar;
